import { RootAction } from '@/types/store'
import { Token } from '@/types/data'
const initiaState: Token = {
  token: '',
  refresh_token: '',
}
export const login = (state = initiaState, action: RootAction): Token => {
  switch (action.type) {
    // 登录获取token
    case 'login/getToken':
      return action.payload

    // 退出登录
    case 'login/Logout':
      return initiaState
    default:
      return state
  }
}
